<template>
  <div>
    <table width="800" border="1" cellspacing="0">
      <thead>
        <tr>
          <th>商品序号</th>
          <th>商品名称</th>
          <th>商品价格</th>
          <th>删除商品</th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="(item,index) in count" :key="index">
          <th>{{index}}</th>
          <th>{{item.title}}</th>
          <th>{{item.price}}</th>
          <th>
            <button @click="del(index)">删除</button>
          </th>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
// 导入bus.js
import Bus from "@/Bus";
export default {
  data() {
    return {
      count:[]
    };
  },
  mounted() {
    this.status()
      
  },
  methods: {
    status(){
        Bus.$on('send',(val)=>{
          console.log(val)
            this.count=val
      })
    },
    del(key) {
        this.count.splice(key,1)
    }
  },
};
</script>

<style lang="scss" >
</style>